<?php
	// Search and modify illegal portions
	$_POST = str_replace("'","''",$_POST);
	$_POST = str_replace("\\","\\\\",$_POST);
	
	// Search for unmodifiable errors
	$clean = true;
	$error = "<div align=\"center\">";
	$error = $error . "The information you submitted have the following errors:<br/><div style='color:#F00'>";
	
	// Check All Numbers for errors
	//Check zip code
	if(!ctype_digit($_POST['zip']) && (strlen($_POST['zip'] != 0))){
		$error = $error . "The zip code you entered has non-numeric characters.<br/>";
		$clean = false;
	}
	
	//Check first contact number
	if(!ctype_digit($_POST['num1']) && (strlen($_POST['num1'] != 0))){
		echo "<br/><b>Temp : >".$temp."<<br/>";
		$error = $error . "The first contact number you entered has non-numeric characters.<br/>";
		$clean = false;
	}
	
	//Check second contact number
	if(!ctype_digit($_POST['num2']) && (strlen($_POST['num2'] != 0))){
		$error = $error . "The second contact number you entered has non-numeric characters.<br/>";
		$clean = false;
	}
	
	//Check third contact number
	if(!ctype_digit($_POST['num3']) && (strlen($_POST['num3'] != 0))){
		$error = $error . "The third contact number you entered has non-numeric characters.<br/>";
		$clean = false;
	}
	
	// Check for blank school name that are essential and return error
	if(strlen($_POST['school']) == 0){
		$error = $error . "The school name is required.<br/>";
		$clean = false;
	}
	
	$error = $error . "</div>Please check the information you have submitted.<br/>";
?>